package SunDayCoding.ControllerStudy;

import java.util.Scanner;

public class ArrayStudy1 {
    public static void main(String[] args) {
        double[] scoresEnglish = new double[10];
        double[] scoresChinese = new double[10];
        Scanner scanner = new Scanner(System.in);
        double sum = 0;
        System.out.println("******************************************");
        System.out.println("请输入本次考试的10名同学英语成绩");
        System.out.println("******************************************");
        //录入成绩
        for (int i = 0; i < scoresEnglish.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个学生的成绩");
            scoresEnglish[i] = scanner.nextDouble();
        }
        System.out.println("////////////////////////输入结束/////////////////////");
        System.out.println("--------------------英语平均分计算如下：---------------------");
        //求平均值
        for (int i = 0; i < scoresEnglish.length; i++) {
            sum += scoresEnglish[i];
        }
        System.out.println("10名同学的英语的平均成绩是 = " + sum / scoresEnglish.length);


        System.out.println("******************************************");
        System.out.println("请输入本次考试的10名同学语文成绩");
        System.out.println("******************************************");
        //录入成绩
        for (int i = 0; i < scoresChinese.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个学生的成绩");
            scoresEnglish[i] = scanner.nextDouble();
        }
        System.out.println("////////////////////////输入结束/////////////////////");
        System.out.println("--------------------英语平均分计算如下：---------------------");
        //求平均值
        for (int i = 0; i < scoresChinese.length; i++) {
            sum += scoresChinese[i];
        }
        System.out.println("10名同学的语文的平均成绩是 = " + sum / scoresChinese.length);


        if (sum / scoresChinese.length > sum / scoresEnglish.length) {
            System.out.println("👏👏👏👏👏👏👏恭喜语文老师，你们班成绩不错!👏👏👏👏");
            System.out.println("英语成绩还需加强!✊✊✊✊✊✊✊✊✊✊✊");
        } else if (sum / scoresChinese.length <sum / scoresEnglish.length){
            System.out.println("👏👏👏👏👏👏👏恭喜英语老师，你们班成绩不错!👏👏👏👏");
            System.out.println("语文成绩还需加强!✊✊✊✊✊✊✊✊✊✊✊");
        }else{
            System.out.println("英语成绩和语文成绩持平，都很棒！💪");
        }


        //计算数组的平均值,并输出
        //1 .遍历计算类加和  2. 累加和除以长度  3.输出
        /*int sum=0;
        double ave;
        for (int i = 0; i < age.length; i++) {
            sum += age[i];
        }
        ave = sum * 1.0 / age.length;
        System.out.println("ave = " + ave);

        //找出最大值
        int max=age[0];
        for (int i = 1; i < age.length; i++) {
            if(max<age[i])
                max = age[i];
        }
        System.out.println("max = " + max);
*/
//        System.out.println("age = " + age[10]);
//        for (int i = 0; i < age.length; i++) {
//            System.out.println("age["+i+"] = " + age[i]);
//        }

    }
}
